package cc.taofoo.Design.Prototype;

import java.io.IOException;

public class Client {
    public static void main(String[] args)  {
        Customer customer = new Customer();
        customer.setAddress(new Address("zh-chuzhou"));
        System.out.println("原型");
        System.out.println(customer);

        System.out.println("浅克隆");
        Customer clone = (Customer) customer.clone();
        System.out.println(clone);

        System.out.println("深克隆");
        Customer deepClone = (Customer) customer.deepClone();
        System.out.println(deepClone);

        /**
         * 输出结果：
         * Customer{address=zh-chuzhou[1581781576]}---->1725154839
         * Customer{address=zh-chuzhou[1581781576]}---->1670675563
         * Customer 的 hashcode 不一致而 address 的 hashcode一致
         */
    }
}
